import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

export default new Router({
  mode: "history",
  base: process.env.BASE_URL,
  routes: [
    {
      path: "/",
      component: () => import("./views/Home.vue"),
      children: [
        {
          path: "",
          name: "home",
          component: () =>
            import(/* webpackChunkName: "group-home" */ "./components/home/PortalView.vue")
        },
        {
          path: "todos",
          name: "todos",
          component: () =>
            import(/* webpackChunkName: "group-common" */ "./components/Todos.vue")
        },
        {
          path: "about",
          name: "about",
          component: () =>
            import(/* webpackChunkName: "group-home" */ "./components/home/About.vue")
        }
      ]
    },
    {
      path: "/personal",
      component: () => import("./views/Personal.vue"),
      children: [
        {
          path: "",
          name: "personal",
          component: () =>
            import(/* webpackChunkName: "group-personal" */ "./components/personal/PortalView.vue")
        },
        {
          path: "todos",
          name: "pertodos",
          component: () =>
            import(/* webpackChunkName: "group-common" */ "./components/Todos.vue")
        },
        {
          path: "description",
          name: "description",
          component: () =>
            import(/* webpackChunkName: "group-personal" */ "./components/personal/Description.vue")
        }
      ]
    },
    // { // 示例代码，留作参考
    //   path: "/about",
    //   name: "about",
    //   // route level code-splitting
    //   // this generates a separate chunk (about.[hash].js) for this route
    //   // which is lazy-loaded when the route is visited.
    //   component: () =>
    //     import(/* webpackChunkName: "about" */ "./views/About.vue")
    // },
    {
      path: "/config",
      name: "config",
      component: () =>
        import(/* webpackChunkName: "group-personal" */ "./views/Config.vue")
    }
  ]
});
